package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import com.campus.app.mapper.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 晚自习值班表
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="OnDuty对象", description="晚自习值班表")
@TableName(excludeProperty ={"studentName1","studentName2"} )

public class OnDuty implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "值班日期")
    private Date date;

    @ApiModelProperty(value = "值班人1")
    @TableField("studentId1")
    private Integer studentid1;
    @NotBlank(groups = Update.class,message = "名字不能为空")
    private String studentName1;
    @ApiModelProperty(value = "值班人2")
    @TableField("studentId2")
    private Integer studentid2;
    @NotBlank(groups = Update.class,message = "名字不能为空")
    private String studentName2;

    public void setStudentid1(Integer studentid1) {
        this.studentid1 = studentid1;
        this.studentName1 = Student.students.get(studentid1).getStuname();
    }

    public void setStudentid2(Integer studentid2) {
        this.studentid2 = studentid2;
        this.studentName2 = Student.students.get(studentid2).getStuname();
    }

}
